import java.util.Objects;

public class EqualsDemo04 {
    public static void main(String[] args) {
        int i = 1;
        int j = 2;
        System.out.println(i == j);
        String s = "老王";
        String s1 = "老王";
//        System.out.println(s == s1);
        System.out.println(s.equals(s1));

        Dog dog = new Dog("哈士奇");
        Dog dog1 = new Dog("哈士奇");
//        System.out.println(dog == dog1);//false
        System.out.println(dog.equals(dog1));//false

        // 如果过名字一样的狗对象，就是认为是相等的
    }
}


class Dog {
    private String name;

    public Dog(String name) {
        this.name = name;
    }


    public boolean equals(Dog o) {

        // String里面的equals
        return this.name.equals(o.name);
    }


}
